﻿using System;
using System.Drawing;
using System.Windows.Forms;
using JobUtil.BllLib;

namespace JobUtil
{
    public partial class MainForm : Form
    {
        readonly Controls.ChangeExtensions _changeExt = new Controls.ChangeExtensions();
        readonly Controls.CheckControl _check = new Controls.CheckControl();


        public MainForm()
        {
            InitializeComponent();
            InitControl();
            

        }

        private void timerDatetime_Tick(object sender, EventArgs e)

        {
            StatusTimeLabel.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
        }

        private void InitControl()
        {

            MainPanel.Controls.Add(_check, 1, 0);
            // On démarre le timer de l'affichage de l'heure
            timerDatetime.Start();
            new TestBusiness().RetrieveStations(1);
        }

        private void changeExtensionsToolStripMenuItem_Click(object sender, EventArgs e)
        {


            if (!MainPanel.Controls.Contains(_changeExt))
            {
                MainPanel.Controls.Add(_changeExt, 0, 0);
            }
        }

        private void MainForm_MinimumSizeChanged(object sender, EventArgs e)
        {

        }

        private void quitterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void MainForm_Resize(object sender, EventArgs e)
        {
            if (FormWindowState.Minimized == WindowState)
            {
                Hide();
            }
        }

        private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
        }


        private void MainPanel_Paint(object sender, PaintEventArgs e)
        {
           

        }

        private void MainForm_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;
        }

        private void incrementSequencesToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void MainPanel_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
        {

            //if (e.Row == 0 && e.Column == 1)
            //{
            //    e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(51,102,255)), e.CellBounds);
            //}

        }

        private void creditsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            new CreditsFrame().Show();
        }

        
    }


}
